class Home
  def initialize(store, date = Time.now)
    @store ||= store
    @date = date
  end

  def pending_orders
    @store.orders.by_week.pending
  end

  def pay_pending_orders
    @store.orders.by_week.pay_pending
  end

  def unfinished_orders
    @store.orders.by_week.unfinished
  end

  def finished_orders
    @store.orders.by_week.complete
  end

  def finished_orders_of_yesterday
    @store.orders.by_date(@date.yesterday).complete
  end

  def orders_amount
    @store.orders.complete.sum(:amount)
  end
end
